<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      img {
        max-width: 300px;
        max-height: 300px;
      }
    </style>
  </head>
  <body>
    <h1>Node Express Server</h1>
    <script>
      window.addEventListener("load", () => {
        if ("serviceWorker" in navigator) {
          navigator.serviceWorker
            .register("./sw.js")
            .then(() => {
              console.log("Service worker registered!");
            })
            .catch((error) => {
              console.warn("Error registering service worker:");
              console.warn(error);
            });
        }
      });
    </script>
    <script>
      fetch("2.jpg").then((res) => {
        console.log("fetch 2.jpg: ", res);
        res.blob().then((data) => {
          const image = new Image();
          image.src = URL.createObjectURL(data);
          document.body.appendChild(image);
        });
      });
    </script>
    <img src="1.jpg" alt="" />
  </body>
</html>
